﻿<%@ Page Title="" Language="C#" MasterPageFile="~/default.master" AutoEventWireup="true" CodeFile="ShowError.aspx.cs" Inherits="SchemaDB_ShowError" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolderMain" Runat="Server">

    <h3>Message</h3>
    <p><span id="Message" runat="server" /></p>

    <h3>Stack Trace</h3>
    <p><pre><span id="StackTrace" runat="server" /></pre></p>

    <h3>Meta Data</h3>
    <table border="0">
        <tr>
            <th>Type:</th>
            <td style="font-family:Courier New,Courier,Fixed"><span id="ErrorType" runat="server" /></td>
        </tr>
        <tr>
            <th>Class:</th>
            <td style="font-family:Courier New,Courier,Fixed"><span id="ClassName" runat="server" /></td>
        </tr>
        <tr>
            <th>Method:</th>
            <td style="font-family:Courier New,Courier,Fixed"><span id="MethodName" runat="server" /></td>
        </tr>
        <tr>
            <th>Reported:</th>
            <td><span id="ErrorCount" runat="server" /> times</td>
        </tr>
    </table>

    <h3>Versions</h3>
    <p><span id="Versions" runat="server" /></p>
    
    <h3>Parents</h3>
    <asp:UpdatePanel 
        ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <asp:GridView ID="GridView1" runat="server" AllowSorting="True" 
                    AutoGenerateColumns="False" DataSourceID="SqlDataSourceParents" 
                    Width="530px">
                    <Columns>
                        <asp:HyperLinkField DataNavigateUrlFields="ErrorHash" 
                            DataNavigateUrlFormatString="ShowError.aspx?Id={0}" 
                            DataTextFormatString="&lt;img src=&quot;../images/ShowError.png&quot; border=&quot;0&quot; /&gt;" 
                            HeaderText="Goto Error" DataTextField="ErrorHash" >
                        <ItemStyle HorizontalAlign="Center" />
                        </asp:HyperLinkField>
                        <asp:BoundField DataField="VersionStr" HeaderText="Version" 
                            SortExpression="VersionStr" 
                            DataFormatString="&lt;nobr&gt;{0}&lt;/nobr&gt;" 
                            HtmlEncodeFormatString="False" >
                        <ItemStyle Wrap="False" />
                        </asp:BoundField>
                        <asp:BoundField DataField="ErrorCount" HeaderText="Count" 
                            SortExpression="ErrorCount" >
                        <ItemStyle HorizontalAlign="Center" Wrap="False" />
                        </asp:BoundField>
                        <asp:BoundField DataField="ErrorType" HeaderText="Error Type" 
                            SortExpression="ErrorType" >
                        <ItemStyle Wrap="False" />
                        </asp:BoundField>
                        <asp:BoundField DataField="ClassName" 
                            HeaderText="Class" SortExpression="ClassName" >
                        <ItemStyle Wrap="False" />
                        </asp:BoundField>
                        <asp:BoundField DataField="MethodName" HeaderText="Method" 
                            SortExpression="MethodName">
                        <ItemStyle Wrap="False" />
                        </asp:BoundField>
                    </Columns>
                    <EmptyDataTemplate>
                        &lt;none&gt;
                    </EmptyDataTemplate>
                </asp:GridView>
            </ContentTemplate>
        </asp:UpdatePanel>
    
    <h3>Children</h3>
    <asp:UpdatePanel 
        ID="UpdatePanel2" runat="server">
            <ContentTemplate>
                <asp:GridView ID="GridView2" runat="server" AllowSorting="True" 
                    AutoGenerateColumns="False" DataSourceID="SqlDataSourceChildren" 
                    Width="530px">
                    <Columns>
                        <asp:HyperLinkField DataNavigateUrlFields="ErrorHash" 
                            DataNavigateUrlFormatString="ShowError.aspx?Id={0}" 
                            DataTextFormatString="&lt;img src=&quot;../images/ShowError.png&quot; border=&quot;0&quot; /&gt;" 
                            HeaderText="Goto Error" DataTextField="ErrorHash" >
                        <ItemStyle HorizontalAlign="Center" />
                        </asp:HyperLinkField>
                        <asp:BoundField DataField="VersionStr" HeaderText="Version" 
                            SortExpression="VersionStr" 
                            DataFormatString="&lt;nobr&gt;{0}&lt;/nobr&gt;" 
                            HtmlEncodeFormatString="False" >
                        <ItemStyle Wrap="False" />
                        </asp:BoundField>
                        <asp:BoundField DataField="ErrorCount" HeaderText="Count" 
                            SortExpression="ErrorCount" >
                        <ItemStyle HorizontalAlign="Center" Wrap="False" />
                        </asp:BoundField>
                        <asp:BoundField DataField="ErrorType" HeaderText="Error Type" 
                            SortExpression="ErrorType" >
                        <ItemStyle Wrap="False" />
                        </asp:BoundField>
                        <asp:BoundField DataField="ClassName" 
                            HeaderText="Class" SortExpression="ClassName" >
                        <ItemStyle Wrap="False" />
                        </asp:BoundField>
                        <asp:BoundField DataField="MethodName" HeaderText="Method" 
                            SortExpression="MethodName">
                        <ItemStyle Wrap="False" />
                        </asp:BoundField>
                    </Columns>
                    <EmptyDataTemplate>
                        &lt;none&gt;
                    </EmptyDataTemplate>
                </asp:GridView>
            </ContentTemplate>
        </asp:UpdatePanel>
    
    <asp:SqlDataSource ID="SqlDataSourceParents" runat="server" 
    ConnectionString="<%$ ConnectionStrings:RouterControlConnectionString %>" 
    
    
    SelectCommand="SELECT Releases.VersionStr, ErrorsGrouped.ErrorCount, ErrorsGrouped.ErrorType, ErrorsGrouped.ClassName, ErrorsGrouped.MethodName, ErrorsGrouped.ErrorHash 
FROM ErrorsGrouped 
INNER JOIN Releases 
ON ErrorsGrouped.ReleaseId = Releases.Id 
WHERE ErrorsGrouped.ErrorHash in (
	select distinct a.ErrorHash
	from ErrorReporting a
	inner join ErrorReporting b
	on a.Id=b.ParentId
	where b.ErrorHash=@hash
)
ORDER BY ErrorsGrouped.ErrorCount DESC
">
        <SelectParameters>
            <asp:QueryStringParameter Name="hash" QueryStringField="Id" />
        </SelectParameters>
</asp:SqlDataSource>
    
    <asp:SqlDataSource ID="SqlDataSourceChildren" runat="server" 
    ConnectionString="<%$ ConnectionStrings:RouterControlConnectionString %>" 
    
    
    SelectCommand="SELECT Releases.VersionStr, ErrorsGrouped.ErrorCount, ErrorsGrouped.ErrorType, ErrorsGrouped.ClassName, ErrorsGrouped.MethodName, ErrorsGrouped.ErrorHash 
FROM ErrorsGrouped 
INNER JOIN Releases 
ON ErrorsGrouped.ReleaseId = Releases.Id 
WHERE ErrorsGrouped.ErrorHash in (
	select distinct a.ErrorHash
	from ErrorReporting a
	inner join ErrorReporting b
	on a.ParentId=b.Id
	where b.ErrorHash=@hash
)
ORDER BY ErrorsGrouped.ErrorCount DESC
">
        <SelectParameters>
            <asp:QueryStringParameter Name="hash" QueryStringField="Id" />
        </SelectParameters>
</asp:SqlDataSource>

        

</asp:Content>

